//
//  Test1Controller.m
//  iosapp
//
//  Created by 吴彬 on 15/12/11.
//  Copyright © 2015年 吴彬. All rights reserved.
//

#import "Test1Controller.h"
#import "PhotoController.h"
#import "CollectionViewController.h"
#import "UNLinearLayout.h"

@interface Test1Controller ()<UITableViewDelegate,UITableViewDataSource>
@property(strong,nonatomic)UITableView *tableView;
@property(strong,nonatomic)NSMutableArray *array;

@end

@implementation Test1Controller

- (void)viewDidLoad {
    [super viewDidLoad];
//    self.automaticallyAdjustsScrollViewInsets = NO;
    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height - 44)];
    self.array = [NSMutableArray arrayWithObjects:@"微信图片选择及处理",@"自定义layout",@"2",@"3",@"4",@"5", nil];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
    [self.view addSubview:self.tableView];
   
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return [self.array count];

}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
    cell.textLabel.text = [self.array objectAtIndex:indexPath.row];
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [self.tableView deselectRowAtIndexPath:indexPath animated:YES];
    if (indexPath.row == 0) {
        [self.navigationController pushViewController:[PhotoController new] animated:YES];
    } else if(indexPath.row == 1){
        
        CollectionViewController *cc = [[CollectionViewController alloc] init];
        [self.navigationController pushViewController:cc animated:YES];
    }
    
}

@end
